//
// Exception.hpp for Exception in /home/mambou_j//babel-2014
// 
// Made by jacquesquentin mamboumouafo
// Login   <mambou_j@epitech.net>
// 
// Started on  Mon May 14 16:27:52 2012 jacquesquentin mamboumouafo
// Last update Mon May 14 16:49:54 2012 jacquesquentin mamboumouafo
//


#ifndef	__EXCEPTION_HPP__
#define	__EXCEPTION_HPP__

#include	<exception>
#include	"portaudio.h"

namespace	portaudio
{

  /////
  /// @brief Base class for all exceptions PortAudioCpp can throw.
  ///
  /// Class is derived from std::exception.
  /////
  class	Exception :	public	std::exception
  {
  public:
    virtual	~Exception() throw() {}
    virtual	const	char	*what() const throw() = 0;
  };

  class	PaException :	public	Exception
  {
  public:
    explicit	PaException(PaError error);

    const	char	*what() const throw();

    PaError	paError() const;
    const	char	*paErrorText() const;

    bool	isHostApiError() const;
    long	lastHostApiError() const;
    const	char	*lastHostApiErrorText() const;

    bool	operator==(const PaException &rhs) const;
    bool	operator!=(const PaException &rhs) const;

  private:
    PaError	error_;
  };


  class	PaCppException :	public	Exception
  {
  public:
	enum	ExceptionSpecifier
	  {
		UNABLE_TO_ADAPT_DEVICE
	  };

    PaCppException(ExceptionSpecifier specifier);

    const	char	*what() const throw();

    bool	operator==(const PaCppException &rhs) const;
    bool	operator!=(const PaCppException &rhs) const;

  private:
    ExceptionSpecifier	specifier_;
  };
}

#endif
